package win.demonlegion.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import win.demonlegion.mapper.UserSaltMapper;
import win.demonlegion.module.UserSaltBean;
import win.demonlegion.service.inte.UserSaltService;
import win.demonlegion.util.GuidUtil;
import win.demonlegion.util.TimestampUtil;

@Service("userSaltService")
public class UserSaltServiceImpl implements UserSaltService {
    @Autowired
    private UserSaltMapper userSaltMapper;

    @Override
    public String selectByUserId(String userId) {
        return userSaltMapper.selectByUserId(userId);
    }

    @Override
    public int add(UserSaltBean userSaltBean){
        userSaltBean.setId(GuidUtil.getUuid());
        userSaltBean.setCreateTime(TimestampUtil.getDatetime());
        return userSaltMapper.add(userSaltBean);
    }

    @Override
    public int update(UserSaltBean userSaltBean) {
        userSaltBean.setCreateTime(TimestampUtil.getDatetime());
        return userSaltMapper.update(userSaltBean);
    }
}
